﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<WebSite.Models.UploadModel>" %>
<%@ Import Namespace="WebSite.Models" %>
<%@ Import Namespace="WebSite.App_Data" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	上传
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

<style type="text/css">
    
    .MasterTable
    {
        background-color:Black;
    }
    .MasterTable .ProjectTD
    {
        background-color:#FFFF99;
        padding:5px;
        white-space:nowrap;
    }
    
    .MasterTable .AdvanceTD
    {
        background-color:#CCFFCC;
        padding:5px;
        white-space:nowrap;
    }
    
    .MasterTable .BudgetTD
    {
        background-color:#99CCFF;
        padding:5px;
        white-space:nowrap;
    }
    
    .MasterTable .ExpenseHTD
    {
        background-color:#FFCC99;
        padding:5px;
        white-space:nowrap;
    }
    
    .MasterTable .ExpenseATD
    {
        background-color:#FF99CC;
        padding:5px;
        white-space:nowrap;
    }
    
    .MasterTable .ExpenseBTD
    {
        background-color:#CC99FF;
        padding:5px;
        white-space:nowrap;
    }
    
    .MasterTable .SelectTD
    {
        background-color:#D4D0C8;
        padding:5px;
        white-space:nowrap;
    }
    
</style>

<script type="text/javascript">

    function SelectAllProject(sender) {

        var lsCheck = $(".MasterTable input[type=checkbox]");

        for (var i = 1; i < lsCheck.length; i++) {
            lsCheck.get(i).checked = sender.checked;
        }
     }

     function OpenDataUpload(ProjectID) {
         var url = 'UploadData/' + ProjectID;
         var strFeature = "dialogWidth:800px;dialogHeight:500px;status:no;help:no;location=no";
         window.showModalDialog(url, "", strFeature);
     }

     function DownLoadTemplate() {

         var lsProjectID = "";
         var lsCheck = $(".MasterTable input[type=checkbox]:checked");

         for (var i = 0; i < lsCheck.length; i++) {
             var ProjectID = lsCheck.eq(i).attr("ProjectId");
             if (ProjectID)
                 lsProjectID = lsProjectID + ProjectID + ",";
         }

         var op = window.open('DownloadTemplate/' + lsProjectID, 'DownLoad', '', '');
         op.focus();

     }

</script>

<% using (Html.BeginForm("Upload_MasterData", "Budget", FormMethod.Post, new { enctype = "multipart/form-data" }))
    { %>
    <input name="uploadMasterDate" type="file" />
    <input type="submit" value="上传主数据" />
    
<% } %>

<% using(Html.BeginForm()){ %>

    <input type="submit" value="下载预算科研模板" onclick='this.form.action="<%=Url.Action("Upload_DownloadTemplate", new {id = 1}) %>";'/>
    <input type="submit" value="下载预算外科研模板" onclick='this.form.action="<%=Url.Action("Upload_DownloadTemplate", new {id = 2}) %>";'/>
    <input type="submit" value="下载有偿服务模板" onclick='this.form.action="<%=Url.Action("Upload_DownloadTemplate", new {id = 3}) %>";'/>
    
<% if (Model != null)
   {
       if (Model.ProjectTable != null)
       { %>
        <table class="MasterTable" border="0" cellpadding="0" cellspacing="1">
            <tr>
                <td class="SelectTD" rowspan="2"><input type="checkbox" onclick="SelectAllProject(this)" /></td>
                <td class="SelectTD" rowspan="2">操作</td>
                <td colspan="13" class="ProjectTD"><b>项目预算信息</b></td>
                <td colspan="3" class="AdvanceTD"><b>垫支</b></td>
                <td colspan="7" class="BudgetTD"><b>预算金额</b></td>
                <td colspan="11" class="ExpenseHTD"><b>历年支出</b></td>
                <td colspan="11" class="ExpenseATD"><b>当年支出（实际）</b></td>
                <td colspan="11" class="ExpenseBTD"><b>当年支出（预算）</b></td>
            </tr>
            <tr>
                <%--项目预算信息--%>
                <td class="ProjectTD">类别</td>
                <td class="ProjectTD">年度</td>
                <td class="ProjectTD">编制单位</td>
                <td class="ProjectTD">项目名称</td>
                <td class="ProjectTD">项目代号</td>
                <td class="ProjectTD">年度进度</td>
                <td class="ProjectTD">经费来源</td>
                <td class="ProjectTD">项目周期-起</td>
                <td class="ProjectTD">项目周期-止</td>
                <td class="ProjectTD">项目负责人</td>
                <td class="ProjectTD">是否为软课题</td>
                <td class="ProjectTD">状态</td>
                <td class="ProjectTD">是否垫支</td>
                    <%--垫支--%>
                <td class="AdvanceTD">拟到经费总额</td>
                <td class="AdvanceTD">预计经费到位时间</td>
                <td class="AdvanceTD">垫支金额</td>
                <%--预算金额--%>
                <td class="BudgetTD">预算金额</td>
                <td class="BudgetTD">标准领报</td>
                <td class="BudgetTD">项目经费</td>
                <td class="BudgetTD">家底弥补</td>
                <td class="BudgetTD">其他收入</td>
                <td class="BudgetTD">上年转入</td>
                <td class="BudgetTD">备注</td>
                <%--历年支出--%>
                <td class="ExpenseHTD">历年支出金额</td>
                <td class="ExpenseHTD">设备费</td>
                <td class="ExpenseHTD">材料费</td>
                <td class="ExpenseHTD">协作费</td>
                <td class="ExpenseHTD">业务费</td>
                <td class="ExpenseHTD">待预算经费</td>
                <td class="ExpenseHTD">备注</td>
                <td class="ExpenseHTD">成本性</td>
                <td class="ExpenseHTD">公用费用</td>
                <td class="ExpenseHTD">分摊费用</td>
                <td class="ExpenseHTD">上缴利润</td>
                <%--当年支出（实际）--%>
                <td class="ExpenseATD">当年支出金额</td>
                <td class="ExpenseATD">设备费</td>
                <td class="ExpenseATD">材料费</td>
                <td class="ExpenseATD">协作费</td>
                <td class="ExpenseATD">业务费</td>
                <td class="ExpenseATD">待预算经费</td>
                <td class="ExpenseATD">备注</td>
                <td class="ExpenseATD">成本性</td>
                <td class="ExpenseATD">公用费用</td>
                <td class="ExpenseATD">分摊费用</td>
                <td class="ExpenseATD">上缴利润</td>
                <%--当年支出（预算）--%>
                <td class="ExpenseBTD">当年支出金额</td>
                <td class="ExpenseBTD">设备费</td>
                <td class="ExpenseBTD">材料费</td>
                <td class="ExpenseBTD">协作费</td>
                <td class="ExpenseBTD">业务费</td>
                <td class="ExpenseBTD">待预算经费</td>
                <td class="ExpenseBTD">备注</td>
                <td class="ExpenseBTD">成本性</td>
                <td class="ExpenseBTD">公用费用</td>
                <td class="ExpenseBTD">分摊费用</td>
                <td class="ExpenseBTD">上缴利润</td>
            </tr>
    <%
            
           for(int i = 0;i < Model.ProjectTable.Count; i++)
           {
               vw_Project oPM = Model.ProjectTable[i];
            %>
            <tr>
                <%--项目预算信息--%>
                <td class="SelectTD"><%=Html.CheckBoxFor(m=>m.ProjectTable[i].IsSelect)%><%=Html.HiddenFor(m=>m.ProjectTable[i].ProjectID) %></td>
                <td class="SelectTD">
                <%
                   switch (Model.ProjectTable[i].ProjectStatus)
                   {
                       case (int)ProjectStatusEnum.Open:
                           %>
                            <input value="上传" type="button" onclick='OpenDataUpload("<%=Model.ProjectTable[i].ProjectID %>")' />
                           <%
                           break;
                       case (int)ProjectStatusEnum.Audit:
                           break;
                       case (int)ProjectStatusEnum.InUse:
                           break;
                       case (int)ProjectStatusEnum.Adjust:
                           break;
                       case (int)ProjectStatusEnum.Complete:
                           break;
                       case (int)ProjectStatusEnum.Close:
                           break;
                   }
                     %>                
                </td>
                <td class="ProjectTD"><%=Html.DisplayFor(m=>m.ProjectTable[i].ProjectCategoryName) %></td><%--类别--%>
                <td class="ProjectTD"><%=oPM.Year%></td><%--年度--%>
                <td class="ProjectTD"><%=oPM.Department%></td><%--编制单位--%>
                <td class="ProjectTD"><%=oPM.ProjectName%></td><%--项目名称--%>
                <td class="ProjectTD"><%=oPM.ProjectCode%></td><%--项目代号--%>
                <td class="ProjectTD"><%=oPM.AnnualProgress%></td><%--年度进度--%>
                <td class="ProjectTD"><%=oPM.FundsSources%></td><%--经费来源--%>
                <td class="ProjectTD"><%=oPM.LifeBegin%></td><%--项目周期-起--%>
                <td class="ProjectTD"><%=oPM.LifeEnd%></td><%--项目周期-止--%>
                <td class="ProjectTD"><%=oPM.ProjectPIC%></td><%--项目负责人--%>
                <td class="ProjectTD"><%=oPM.IsSoft%></td><%--是否为软课题--%>
                <td class="ProjectTD"><%=oPM.ProjectStatusName%></td><%--状态--%>
                <td class="ProjectTD"><%=oPM.ProjectIsAdvanceName%></td><%--是否垫支--%>
                <%--垫支--%>
                <td class="AdvanceTD"><%=oPM.PlanAmount%></td><%--拟到经费总额--%>
                <td class="AdvanceTD"><%=oPM.PlanTime%></td><%--预计经费到位时间--%>
                <td class="AdvanceTD"><%=oPM.AdvanceAmount%></td><%--垫支金额--%>
                <%--预算金额--%>
                <td class="BudgetTD"><%=oPM.Budget_Amount%></td><%--预算金额--%>
                <td class="BudgetTD"><%=oPM.Budget_StandardFunds%></td><%--标准领报--%>
                <td class="BudgetTD"><%=oPM.Budget_ProjectFunds%></td><%--项目经费--%>
                <td class="BudgetTD"><%=oPM.Budget_Subvention%></td><%--家底弥补--%>
                <td class="BudgetTD"><%=oPM.Budget_OtherIncome%></td><%--其他收入--%>
                <td class="BudgetTD"><%=oPM.Budget_Balance%></td><%--上年转入--%>
                <td class="BudgetTD"><%=oPM.Budget_Rem%></td><%--备注--%>
                <%--历年支出--%>
                <td class="ExpenseHTD"><%=oPM.ExpenseH_Amount%></td><%--历年支出金额--%>
                <td class="ExpenseHTD"><%=oPM.ExpenseH_EquipmentCost%></td><%--设备费--%>
                <td class="ExpenseHTD"><%=oPM.ExpenseH_MaterialCost%></td><%--材料费--%>
                <td class="ExpenseHTD"><%=oPM.ExpenseH_CooperationFee%></td><%--协作费--%>
                <td class="ExpenseHTD"><%=oPM.ExpenseH_BusinessFee%></td><%--业务费--%>
                <td class="ExpenseHTD"><%=oPM.ExpenseH_PendingFunds%></td><%--待预算经费--%>
                <td class="ExpenseHTD"><%=oPM.ExpenseH_Rem%></td><%--备注--%>
                <td class="ExpenseHTD"><%=oPM.ExpenseH_BaseCost%></td><%--成本性--%>
                <td class="ExpenseHTD"><%=oPM.ExpenseH_PublicExpense%></td><%--公用费用--%>
                <td class="ExpenseHTD"><%=oPM.ExpenseH_ChargeExpense%></td><%--分摊费用--%>
                <td class="ExpenseHTD"><%=oPM.ExpenseH_Profits%></td><%--上缴利润--%>
                <%--当年支出（实际）--%>
                <td class="ExpenseATD"><%=oPM.ExpenseA_Amount%></td><%--当年支出金额--%>
                <td class="ExpenseATD"><%=oPM.ExpenseA_EquipmentCost%></td><%--设备费--%>
                <td class="ExpenseATD"><%=oPM.ExpenseA_MaterialCost%></td><%--材料费--%>
                <td class="ExpenseATD"><%=oPM.ExpenseA_CooperationFee%></td><%--协作费--%>
                <td class="ExpenseATD"><%=oPM.ExpenseA_BusinessFee%></td><%--业务费--%>
                <td class="ExpenseATD"><%=oPM.ExpenseA_PendingFunds%></td><%--待预算经费--%>
                <td class="ExpenseATD"><%=oPM.ExpenseA_Rem%></td><%--备注--%>
                <td class="ExpenseATD"><%=oPM.ExpenseA_BaseCost%></td><%--成本性--%>
                <td class="ExpenseATD"><%=oPM.ExpenseA_PublicExpense%></td><%--公用费用--%>
                <td class="ExpenseATD"><%=oPM.ExpenseA_ChargeExpense%></td><%--分摊费用--%>
                <td class="ExpenseATD"><%=oPM.ExpenseA_Profits%></td><%--上缴利润--%>
                <%--当年支出（预算）--%>
                <td class="ExpenseBTD"><%=oPM.ExpenseB_Amount%></td><%--当年支出金额--%>
                <td class="ExpenseBTD"><%=oPM.ExpenseB_EquipmentCost%></td><%--设备费--%>
                <td class="ExpenseBTD"><%=oPM.ExpenseB_MaterialCost%></td><%--材料费--%>
                <td class="ExpenseBTD"><%=oPM.ExpenseB_CooperationFee%></td><%--协作费--%>
                <td class="ExpenseBTD"><%=oPM.ExpenseB_BusinessFee%></td><%--业务费--%>
                <td class="ExpenseBTD"><%=oPM.ExpenseB_PendingFunds%></td><%--待预算经费--%>
                <td class="ExpenseBTD"><%=oPM.ExpenseB_Rem%></td><%--备注--%>
                <td class="ExpenseBTD"><%=oPM.ExpenseB_BaseCost%></td><%--成本性--%>
                <td class="ExpenseBTD"><%=oPM.ExpenseB_PublicExpense%></td><%--公用费用--%>
                <td class="ExpenseBTD"><%=oPM.ExpenseB_ChargeExpense%></td><%--分摊费用--%>
                <td class="ExpenseBTD"><%=oPM.ExpenseB_Profits%></td><%--上缴利润--%>
            </tr>
            <%
           }
        
        %>
        </table>
<%      }
   } %>

<% } %>

<% using (Html.BeginForm("Upload", "Budget", FormMethod.Post, new { enctype = "multipart/form-data" }))
    { %>
    <input name="uploadBudgetFile" type="file" />
    <input type="submit" value="上传" />
<%} %>

</asp:Content>
